package com.aaa.service.impl;

import com.aaa.dao.DoctorDao;
import com.aaa.entity.Doctor;
import com.aaa.service.DoctorService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class DoctorServiceImpl implements DoctorService {
    @Autowired
    DoctorDao dd;

    @Override
    public PageInfo findDoctor(String dynName, String docName, String grand, int page, int size) {
        PageHelper.startPage(page,size);
        List list=dd.findDoctor(dynName,docName,grand);
        return new PageInfo(list);
    }

    @Override
    public Map findDoctorById(int docId) {
        return dd.findDoctorById(docId);
    }

    @Override
    public List<Map> findDoctorDesc() {
        return dd.findDoctorDesc();
    }

    @Override
    public int updateDoctor(Doctor doctor) {
        return dd.updateDoctor(doctor);
    }

    @Override
    public int addDoctor(Doctor doctor) {
        return dd.addDoctor(doctor);
    }

    @Override
    public int doctorDel(int docId) {
        return dd.doctorDel(docId);
    }

    @Override
    public int checkDoctor(int fk_cid,int fk_dynId,String docSurname,String docName) {
        return dd.checkDoctor(fk_cid,fk_dynId,docSurname,docName);
    }

    @Override
    public PageInfo findDoctorRepeat(int page,int size) {
        PageHelper.startPage(page,size);
        List<Map> list= dd.findDoctorRepeat();
        return new PageInfo(list);
    }
}
